//
//  NSObject+XBAdd.h
//  XBCategoriesDemo
//
//  Created by kevin007 on 2021/4/12.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSObject (XBAdd)
/// 延迟调用方法，延时时间内，如果频发触发调用时自动取消前一次方法调用
/// @param selector SEL
/// @param object any object
/// @param second 延迟时间 单位秒
- (void)previousPerformSelector:(SEL)selector
                     withObject:(id)object
                     afterDelay:(NSTimeInterval)second;


#pragma mark - Associate value (From YYAdd)
///=============================================================================
/// @name Associate value
///=============================================================================

/**
 Associate one object to `self`, as if it was a strong property (strong, nonatomic).
 
 @param value   The object to associate.
 @param key     The pointer to get value from `self`.
 */
- (void)setAssociateValue:(nullable id)value withKey:(void *)key;

/**
 Associate one object to `self`, as if it was a weak property (week, nonatomic).
 
 @param value  The object to associate.
 @param key    The pointer to get value from `self`.
 */
- (void)setAssociateWeakValue:(nullable id)value withKey:(void *)key;

/**
 Get the associated value from `self`.
 
 @param key The pointer to get value from `self`.
 */
- (nullable id)getAssociatedValueForKey:(void *)key;

/**
 Remove all associated values.
 */
- (void)removeAssociatedValues;
@end

NS_ASSUME_NONNULL_END
